package xiaoqi.springboot.boot.rpc.core;

public class ServiceException extends RuntimeException {

    private Integer code;

    public ServiceException() {} // 创建默认构造方法，用于反序列化的场景。

    public ServiceException(ServiceExceptionEnum serviceExceptionEnum) {
        super(serviceExceptionEnum.getMessage());
        this.code = serviceExceptionEnum.getCode();
    }

    public ServiceException(ServiceExceptionEnum serviceExceptionEnum, String message) {
        super(message);
        this.code = serviceExceptionEnum.getCode();
    }


    public Integer getCode() {
        return code;
    }
}
